package com.wc.alorithm_luogu.P1957;

import java.util.ArrayList;
import java.util.Objects;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/22 14:20
 * @description https://www.luogu.com.cn/problem/P1957
 * 口算练习题
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());

        // 当前运算符
        String curOpt = null;
        // 参与运算的数
        int a;
        int b;
        String every = null;
        // 运算式子长度
        int length = 0;
        // 存放答案
        ArrayList<String> ans = new ArrayList<>();
        while (n-- > 0) {
            // 将一行按照空格分隔开
            String[] split = sc.nextLine().split(" ");
            if (split.length == 3) {
                curOpt = split[0];
                a = Integer.parseInt(split[1]);
                b = Integer.parseInt(split[2]);
            } else {
                a = Integer.parseInt(split[0]);
                b = Integer.parseInt(split[1]);
            }
            switch (Objects.requireNonNull(curOpt)) {
                case "a": {
                    every = a + "+" + b + "=" + (a + b);
                    length = every.length();
                    break;
                }
                case "b": {
                    every = a + "-" + b + "=" + (a - b);
                    length = every.length();
                    break;
                }
                case "c": {
                    every = a + "*" + b + "=" + (a * b);
                    length = every.length();
                    break;
                }
                default:
                    break;
            }
            ans.add(every);
            ans.add(String.valueOf(length));
        }

        // 打印答案
        for (String s : ans) {
            System.out.println(s);
        }
    }
}
